package cn.ruituo.adv7;

public class Worker extends  Thread {
    public Worker(String n){
        super(n);
    }

    @Override
    public void run() {
        while(true){
            System.out.println(super.getName()+"干了一会活");
            try {
                sleep(1000);
                System.out.println(super.getName()+"睡到自然醒，继续干活");
            } catch (InterruptedException e) {
                e.printStackTrace();
                System.out.println(super.getName()+"被喊醒，继续干活");
            }
        }
    }
}
